package icu.youcompleteme.order.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;

/**
 * projectName: demo4springcloudalibaba
 * className: OrderController
 * description: 类描述
 *
 * @author : chengjiang@myjava.youcompleteme.icu
 * @since : 2022/11/08
 */

@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    RestTemplate restTemplate;

    @GetMapping("/add/{id}")
    public String order(@PathVariable("id") String id){
        System.out.println("order successfully: "+ id);
        String getStr = restTemplate.getForObject("http://stock-service/stock/reduce", String.class);
        return "order successfully id:"+id+getStr;
    }
}
